package design.event;

/**
 * 监听器(观察者)
 */
public class Reader implements WriterListener{

    //读者用户信息
    private User user;

    public Reader(String userName){
        user = new User();
        user.setUserName(userName);
    }

    @Override
    public void addNovel(WriterEvent writerEvent) {
        System.out.println(user.getUserName()+"发现了"+writerEvent.getWriter().getUser().getUserName()+"的新书:"+writerEvent.getWriter().getLastBook());
    }

    public User getUser() {
        return user;
    }
    public void setUser(User user) {
        this.user = user;
    }
}
